// pages/DatsUpload/DatsUpload.js





Page({

  /**
   * 页面的初始数据
   */
  data: {

    let_index : null,
    med_index : null,
    rgt_index : null,
    backside : [
      {'name':"正常",'num':''},
      {'name':"驼背",'num':'1/2'},
      {'name':"驼背",'num':''}
    ],
    shapeside :['正常','微瘦','微胖','偏瘦','偏胖','极瘦','极胖'],
    shoulderside : ['正常','一字肩','溜肩'],


    Sex : ['男','女'],
    index: 0,

    UserInfo : {
      Username : '',
      Age : 0 ,
      Sex : '',
      height : 0,
      weight : 0,
      Shoesize : 0,
      shoulderwidth : 0,
      bust : 0,
      abdominal : 0,
      waist : 0,
      axilla : 0,
      collar : 0,
      upperbody : 0,
      brachium :  0,
      arm : 0,
      thighwidth : 0,
      calfwidth : 0,
      skirtapron : 0,
      lower : 0,
      leg : 0,
      buttock : 0,
      thighheight : 0,
      calfheight : 0,
      backside : '',
      shapeside : '',
      shoulderside : ''
    }
  },

  nameInput (e) {
    let value = e.detail.value;
    this.setData ({
      'UserInfo.Username' : value
    })
  },
  AgeInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.Age' : value
    })
  },
  SexInput (e) {
    let value = e.detail.value;
    this.setData ({
      index : value,
      'UserInfo.Sex' : value
    })
  },
  heightInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.height' : value
    })
  },
  weightInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.weight' : value
    })
  },
  ShoeInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.Shoesize' : value
    })
  },
  shoulderInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.shoulderwidth' : value
    })
  },
  bustInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.bust' : value
    })
  },
  abdominalInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.abdominal' : value
    })
  },
  waistInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.waist' : value
    })
  },
  axillaInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.axilla' : value
    })
  },
  collarInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.collar' : value
    })
  },
  upperbodyInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.upperbody' : value
    })
  },
  brachiumInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.brachium' : value
    })
  },
  armInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.arm' : value
    })
  },

  lowerInput(e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.lower' : value
    })
  },
  legInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.leg' : value
    })
  },
  buttockInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.buttock' : value
    })
  },




  thighwidthInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.thighwidth' : value
    })
  },
  calfwidthInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.calfwidth' : value
    })
  },
  skirtapronInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.skirtapron' : value
    })
  },
  thighheightInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.thighheight' : value
    })
  },
  calfheightInput (e) {
    let value = Number(e.detail.value);
    this.setData ({
      'UserInfo.calfheight' : value
    })
  },

  let_click (e) {
    let index = e.currentTarget.dataset.index;
    let backside = this.data.backside;
    if (index == 1) {
      let value = backside[index].num + backside[index].name;
      this.setData ({
        'UserInfo.backside' : value
      })
    } else {
      let value = backside[index].name;
      this.setData ({
        'UserInfo.backside' : value
      })
    }

    this.setData ({
      let_index : index ,
    })
  },
  med_click (e) {
    let index = e.currentTarget.dataset.index;
    let shapeside = this.data.shapeside;
    let value = shapeside[index];
    this.setData ({
      med_index : index ,
      'UserInfo.shapeside' : value
    })
  },
  rgt_click (e) {
    let index = e.currentTarget.dataset.index;
    let shoulderside = this.data.shoulderside;
    let value = shoulderside[index];
    this.setData ({
      rgt_index : index ,
      'UserInfo.shoulderside' : value
    })
  },
  preview (e) {
    let UserInfo = JSON.stringify(this.data.UserInfo);
    wx.navigateTo({
      url: '/pages/DatsUpload/Uploadpreview/Uploadpreview?Userinfo=' + UserInfo
    })
  },




  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})